package br.urca.db;

import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public class FabricaDaJPA {
	
	@PersistenceContext
	private EntityManager manager;

	@Produces
	public EntityManager getManager() {
		return manager;
	}

	/*@Produces
	@PersistenceContext
	public EntityManager criaEntityManager(EntityManagerFactory factory) {
		return factory.createEntityManager();
	}
	
	@Produces
	@ApplicationScoped
	public EntityManagerFactory criaEntityManagerFactory() {		
		return Persistence.createEntityManagerFactory("default");
	}
	
	public void fechaManager(@Disposes EntityManager manager) {
		manager.close();
	}
	
	public void fechaFactory(@Disposes EntityManagerFactory factory) {
		factory.close();
	}*/
	
}
